#include<iostream>
using namespace std;
int main(){
	int m,n;
	cin>>m>>n;
	cout<<m%10*n%10%10;
} 
